<?php

use think\migration\Seeder;

class SystemMenuSeeder extends Seeder
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * http://docs.phinx.org/en/latest/seeding.html
     */
    public function run()
    {
        $datas = [
            ['id' => '2',
                'pid' => '0',
                'title' => '系统管理',
                'node' => '',
                'icon' => '',
                'url' => '#',
                'params' => '',
                'target' => '_self',
                'sort' => '100',
                'status' => '1',
            ], ['id' => '3',
                'pid' => '4',
                'title' => '系统菜单管理',
                'node' => '',
                'icon' => 'layui-icon layui-icon-layouts',
                'url' => 'admin/menu/index',
                'params' => '',
                'target' => '_self',
                'sort' => '1',
                'status' => '1',
            ], ['id' => '4',
                'pid' => '2',
                'title' => '系统配置',
                'node' => '',
                'icon' => '',
                'url' => '#',
                'params' => '',
                'target' => '_self',
                'sort' => '20',
                'status' => '1',
            ], ['id' => '5',
                'pid' => '12',
                'title' => '系统用户管理',
                'node' => '',
                'icon' => 'layui-icon layui-icon-username',
                'url' => 'admin/user/index',
                'params' => '',
                'target' => '_self',
                'sort' => '1',
                'status' => '1',
            ], ['id' => '7',
                'pid' => '12',
                'title' => '访问权限管理',
                'node' => '',
                'icon' => 'layui-icon layui-icon-vercode',
                'url' => 'admin/auth/index',
                'params' => '',
                'target' => '_self',
                'sort' => '2',
                'status' => '1',
            ], ['id' => '11',
                'pid' => '4',
                'title' => '系统参数配置',
                'node' => '',
                'icon' => 'layui-icon layui-icon-set',
                'url' => 'admin/config/info',
                'params' => '',
                'target' => '_self',
                'sort' => '4',
                'status' => '1',
            ], ['id' => '12',
                'pid' => '2',
                'title' => '权限管理',
                'node' => '',
                'icon' => '',
                'url' => '#',
                'params' => '',
                'target' => '_self',
                'sort' => '10',
                'status' => '1',
            ], ['id' => '1000',
                'pid' => '0',
                'title' => '平台管理',
                'node' => '',
                'icon' => '',
                'url' => '#',
                'params' => '',
                'target' => '_self',
                'sort' => '499',
                'status' => '1',
            ], ['id' => '59',
                'pid' => '1000',
                'title' => '账单列表',
                'node' => '',
                'icon' => 'layui-icon layui-icon-date',
                'url' => 'admin/account/index',
                'params' => '',
                'target' => '_self',
                'sort' => '0',
                'status' => '1',
            ], ['id' => '42',
                'pid' => '1000',
                'title' => '会员信息管理',
                'node' => '',
                'icon' => 'layui-icon layui-icon-user',
                'url' => 'admin/member/index',
                'params' => '',
                'target' => '_self',
                'sort' => '0',
                'status' => '1',
            ], ['id' => '46',
                'pid' => '4',
                'title' => '短信发送记录',
                'node' => '',
                'icon' => 'layui-icon layui-icon-console',
                'url' => 'admin/oplog/sms',
                'params' => '',
                'target' => '_self',
                'sort' => '4',
                'status' => '1',
            ], ['id' => '49',
                'pid' => '4',
                'title' => '系统日志管理',
                'node' => '',
                'icon' => 'layui-icon layui-icon-form',
                'url' => 'admin/oplog/index',
                'params' => '',
                'target' => '_self',
                'sort' => '2',
                'status' => '1',
            ], ['id' => '56',
                'pid' => '0',
                'title' => '平台概况',
                'node' => '',
                'icon' => '',
                'url' => 'admin/platform/index',
                'params' => '',
                'target' => '_self',
                'sort' => '500',
                'status' => '1',
            ], ['id' => '60',
                'pid' => '4',
                'title' => '数据备份管理',
                'node' => '',
                'icon' => 'fa fa-database',
                'url' => 'admin/database/index',
                'params' => '',
                'target' => '_self',
                'sort' => '0',
                'status' => '1',
            ], ['id' => '66',
                'pid' => '4',
                'title' => '微信小程序配置',
                'node' => '',
                'icon' => 'fa fa-wechat',
                'url' => 'admin/config/wechat',
                'params' => '',
                'target' => '_self',
                'sort' => '0',
                'status' => '1',
            ],
        ];
        $this->table('system_menu')->insert($datas)->save();
//        $data = Db::name('system_menu')->select();
//        $string = '';
//        foreach ($data as $vals){
//            $str = '';
//            foreach ($vals as $key=>$value){
//                if($key != 'create_at'){
//                    $str.="'{$key}' => '{$value}',".PHP_EOL;
//                }
//
//            }
//            $string.= "[{$str}],";
//        }
    }
}